import echarts from 'echarts'
const formatUtil = echarts.format

export default {
  backgroundColor: '#1c213e',
  tooltip: {
    formatter: function (info) {
      let value = info.value
      let treePathInfo = info.treePathInfo
      let treePath = []

      for (let i = 1; i < treePathInfo.length; i++) {
        treePath.push(treePathInfo[i].name)
      }

      return [
        '<div class="tooltip-title">' + formatUtil.encodeHTML(treePath.join('/')) + '</div>',
        '表具数量:' + formatUtil.addCommas(value) + '只'
      ].join('')
    }
  },
  series: [{
    name: '位置',
    type: 'treemap',
    roam: false,
    nodeClick: false,
    breadcrumb: {
    },
    label: {
      fontSize: 22
    },
    visibleMin: 300,
    leafDepth: 2,
    itemStyle: {
      borderColor: '#fff'
    },
    levels: [
      {
        itemStyle: {
          borderWidth: 0,
          gapWidth: 3
        }
      },
      {
        itemStyle: {
          gapWidth: 1
        }
      },
      {
        colorSaturation: [0.35, 0.5],
        itemStyle: {
          gapWidth: 1,
          borderColorSaturation: 0.6
        }
      }
    ],
    top: 0,
    right: 0,
    bottom: 0,
    left: 0
  }]
}
